import React, { FC, createContext,useReducer } from 'react'
import List from './list.tsx'
import InputForm from './inputForm.tsx'
import initialState from './store.ts'
import reducer, {ActionType} from './reducer.ts'

export const TodoContext = createContext({
    state: initialState,
    dispatch: (action: ActionType) =>{}
})
const Demo: FC = ()=>{
    const [state,dispatch] = useReducer(reducer,initialState)
    return (
        <TodoContext.Provider value={{state,dispatch}}>
            <List />
            <InputForm />
        </TodoContext.Provider>
    )
}

export default Demo
